<?php

namespace App\Http\Controllers\Api\Weixin;

use Excel;
use Carbon\Carbon;
use Illuminate\Http\Request;
use App\Exports\WeixinExport;
use App\Http\Controllers\Api\Controller;

class ExportController extends Controller
{
    public function export(Request $request)
    {
        $datas = $request->datas;
        $datas = [
            [1, 2, 3, 4, 5, 6, 7, 8],
            [9, 10, 11, 12, 13, 14, 15, 16]
        ];
        // foreach ($datas as $key => &$value) {
        //     $timestamp = Carbon::now()->timestamp;
        //     array_push($value, $timestamp);
        // }
        $timestamp = Carbon::now()->toDateTimeString();
        // dd(gettype($timestamp));
        // dd(123);
        Excel::store(new WeixinExport($datas))->download($timestamp . '节点数据统计表' . '.xlsx');
        dd(123);
        return (new WeixinExport($datas))->download($timestamp . '节点数据统计表' . '.xlsx');
        
    }
}
